const Router = require('koa-router');
const requireDirectory = require('require-directory');
class InitManager {

    static initCore(app){
        InitManager.app = app;
        InitManager.loadRouters();
    }

    static loadRouters(){
        const appDirectory = `${process.cwd()}/app/api`;

        requireDirectory(module,appDirectory,{
            visit(router){

                if(router instanceof Router){
                    InitManager.app.use(router.routes())
                }
            }
        })

    }

}

module.exports = InitManager;

